# encoding: utf-8
'''
Created on 2018年5月30日

@author: mengqiang.song
'''

from flask import render_template,request, redirect, url_for
from app import app
from app.service.ImgInfoCollect import BaiduImgCollectService
@app.route('/', methods = ['GET', 'POST'])
@app.route('/index', methods = ['GET', 'POST'])
@app.route('/index/<int:page>',methods = ['GET','POST'])
def index():
    return render_template('index.html',
            title = 'Home')
    
@app.route('/baidu_img_collect_page', methods = ['GET', 'POST'])  
def baidu_img_collect_page():
    return render_template("baidu_img_collect.html");

@app.route('/baidu_img_collect', methods = ['GET', 'POST'])  
def baidu_img_collect():
    app.logger.info("进入百度图片收集控制层")
    keyword = request.form.get('keyword')
    count = request.form.get('count')
    print('keyword:',keyword,' count:',count)
    bcService = BaiduImgCollectService();
    bcService.doCollect(keyword,count);
    app.logger.info("进入百度图片收集控制层-结束")
    return render_template("baidu_img_collect.html");